<?php
    require('./Utils.php');

    $post = getJsonParamter();

    $image = $post['image'];
    $username = $post['username'];

    $conn = getConnection();
    $sql = "UPDATE user SET avatar = ? WHERE username = ?";

    $result = execute($conn, $sql, $image, $username);

    if($result){
        getJson(200, '更新成功', null);
    }else{
        getJson(500, '更新失败', null);
    }
?>